package com.qf.device.service.impl;

import com.qf.device.entity.DeviceTopic;
import com.qf.device.mapper.DeviceTopicMapper;
import com.qf.device.service.DeviceTopicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 * Topic主题表 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-10-26
 */
@Service
public class DeviceTopicServiceImpl extends ServiceImpl<DeviceTopicMapper, DeviceTopic> implements DeviceTopicService {

    @Autowired
    private DeviceTopicMapper deviceTopicMapper;

    @Override
    public Result findByDeviceKey(String deviceKey) {
        List<DeviceTopic> topicList = deviceTopicMapper.findByDeviceKey(deviceKey);
        if (StringUtils.isEmpty(topicList)){
            return new Result(1,"fail");
        }
        return new Result(0,"success",topicList);
    }
}
